import { BASE_URL } from "@/settings";
import request from "@/utils/request";

// 个人签署短信验证码
export function sendCodeReq(phone) {
  return request({
    url: `${BASE_URL}/contract/api/v1/signs/sendCode`,
    method: "post",
    data: phone
  });
}

// 个人签署
export function personSignReq(data) {
  return request({
    url: `${BASE_URL}/contract/api/v1/signs/personSign`,
    method: "post",
    data
  });
}

// 查询员工合同记录查询员工合同列表
export function myContractList() {
  return request({
    url: `${BASE_URL}/hr/api/v1/contracts/contact/myContract`,
    method: "GET"
  });
}

// 根据id查询合同类型
export function categoriesType(categoryId) {
  return request({
    url: `${BASE_URL}/hr/api/v1/contracts/categories/${categoryId}`,
    method: "GET"
  });
}

export function checkEleContractReq(contractId) {
  return request({
    url: `${BASE_URL}/contract/api/v1/appendixes/selectByContractId/${contractId}`,
    method: "GET"
  });
}

// 公告接收人获取自己在某公司的公告
export function listSysNoticeByUser0(companyId) {
  return request({
    url: `${BASE_URL}/hr/api/v1/companySysNotices/listSysNoticeByUser/${companyId}?orderByTop=true`,
    method: "GET"
  });
}
// 公告接收人获取自己在某公司的公告
export function listSysNoticeByUser(companyId) {
  return request({
    url: `${BASE_URL}/hr/api/v1/companySysNotices/listSysNoticeByUser/${companyId}`,
    method: "get"
  });
}

// 根据系统公告id获取公告详情(公告获取人用)
export function findSysNoticeByUser0(sysNoticeId) {
  return request({
    url: `${BASE_URL}/hr/api/v1/companySysNotices/findSysNoticeByUser/${sysNoticeId}`,
    method: "GET"
  });
}
// 根据系统公告id获取公告详情(公告接收人用)
export function findSysNoticeByUser(sysNoticeId) {
  return request({
    url: `${BASE_URL}/hr/api/v1/companySysNotices/findSysNoticeByUser/${sysNoticeId}`,
    method: "get"
  });
}
// 批量删除用户接收到的公告(公告接收人用)
export function deleteSysNotices(data) {
  return request({
    url: `${BASE_URL}/hr/api/v1/companySysNotices/deleteUserSysNotice`,
    method: "delete",
    data
  });
}

// 查询用户通知,当前登录用户的所有通知
export function listNoticeCurrentUser(companyId, publishEmpId) {
  return request({
    url: `${BASE_URL}/hr/api/v1/empNotices/listNoticeCurrentUser/${companyId}?publishEmpId=${publishEmpId}`,
    method: "GET"
  });
}

// 根据员工通知id查询员工通知详情
// export function empNoticesInfo(empNoticeId){
//   return request({
//     url: `${BASE_URL}/hr/api/v1/empNotices/${empNoticeId}`,
//     method: 'GET'
//   })
// }

// 查看用户通知的详情(通知接收者)
export function empNoticesInfo(sysNoticeId) {
  return request({
    url: `${BASE_URL}/hr/api/v1/empNotices/findUserNotice/${sysNoticeId}`,
    method: "GET"
  });
}

// 将用户通知置为已读(通知接收者)
export function readUserNotice(userNoticeId, empId) {
  return request({
    url: `${BASE_URL}/hr/api/v1/empNotices/readUserNotice/${userNoticeId}?empId=${empId}`,
    method: "put"
  });
}
// /hr/api/v1/empNotices/readUserNotice/{userNoticeId}
// 将某一系统公告置为已读(公告接收人用)
export function readUserNotice1(sysNoticeId) {
  return request({
    url: `${BASE_URL}/hr/api/v1/companySysNotices/readSysNotice/${sysNoticeId}`,
    method: "put"
  });
}

// 获取首页顶部个人信息
export function getMyInfoReq() {
  return request({
    url: `${BASE_URL}/hr/api/v1/users/smallProgramGetCurrentUserInfo`,
    method: "get"
  });
}

// 获取文章
export function getArtcal(data) {
  return request({
    url: `${BASE_URL}/hr/api/v1/articles`,
    method: "get",
    data
  });
}
export function getSwitch() {
  return request({
    url: `${BASE_URL}/hr/api/v1/socCache/deceive`,
    method: "get"
  });
}
//查询应用已开启的模块
export function getSwitchModule(data) {
  return request({
    url: `${BASE_URL}/admin/api/v1/subjectFunctionModulars/subjectList`,
    method: "get",
    data
  });
}
//根据动态码获取用工单位信息
export function getByDynamicCode(data) {
  return request({
    url: `${BASE_URL}/hr/api/v1/miniProgram/getByDynamicCode`,
    method: "get",
    data
  });
}
//根据合同pdf转图片放到合同文件中(签署完调用)
export function setJpgToAppendix(contractId) {
  return request({
    url: `${BASE_URL}/hr/api/v1/contracts/setJpgToAppendix/${contractId}`,
    method: "put"
  });
}
// 获取个人的签署链接
export function getPersonalSignUrl(data) {
  return request({
    url: `${BASE_URL}/hr/api/v1/contracts/getUrl`,
    method: "get",
    data
  });
}
